function BXBlockEditorHelper(){}BXBlockEditorHelper.prototype.colorHexToRgb=function(e){if(!e){return e}var t=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;e=e.replace(t,function(e,t,r,i){return t+t+r+r+i+i});var r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return r?"rgb("+parseInt(r[1],16)+", "+parseInt(r[2],16)+", "+parseInt(r[3],16)+")":null};BXBlockEditorHelper.prototype.appendChildNode=function(e,t,r){r=r||null;if(r){t.parentNode.insertBefore(e,t)}else{var i=BX.findNextSibling(t);if(i){t.parentNode.insertBefore(e,i)}else{t.parentNode.appendChild(e)}}};BXBlockEditorHelper.prototype.colorRgbToHex=function(e){if(!e||e.substring(0,1)==="#"){return e}var t=/(.*?)rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/.exec(e);if(!t)return null;var r=parseInt(t[2]);var i=parseInt(t[3]);var n=parseInt(t[4]);var o=n|i<<8|r<<16;var a="000000"+o.toString(16);a=a.substring(a.length,a.length-6);return t[1]+"#"+a};BXBlockEditorHelper.prototype.column=function(e,t,r){var i=1;var n=BX.findParent(e,{className:"bxBlockInn"},true);if(n){for(var o in n.childNodes){if(n.childNodes[o]&&n.childNodes[o].nodeName=="#text"){BX.remove(n.childNodes[o])}}if(typeof r!=="undefined"){var a;var l=n.childNodes.length-r;if(l>0){while(l>0){BX.remove(n.childNodes[n.childNodes.length-1]);l--}}else if(l<0){while(l<0){a=BX.clone(n.childNodes[0]);n.appendChild(a);l++}}var d=null;if(n.childNodes.length==3){d="210"}else if(n.childNodes.length==2){d="318"}for(var o in n.childNodes){if(n.childNodes[o]&&n.childNodes[o].setAttribute){n.childNodes[o].setAttribute("width",d)}}}i=n.childNodes.length}return i.toString()};BXBlockEditorHelper.prototype.color=function(e,t,r){if(typeof r!=="undefined"){var i=r;if(r.length>0){r=this.colorHexToRgb(r)}this.style(e,t,r);if(t=="background-color"&&e.tagName=="TABLE"){this.attr(e,"bgcolor",i)}}r=this.style(e,t);return this.colorRgbToHex(r)};BXBlockEditorHelper.prototype.style=function(e,t,r){if(!e){return}if(typeof r!=="undefined"){if(r.length>0)e.style[t]=r;else e.style[t]=null}return e.style[t]};BXBlockEditorHelper.prototype.attr=function(e,t,r){if(!e){return}if(typeof r!=="undefined"){if(r!==null&&r.length>0){e.setAttribute(t,r)}else{e.removeAttribute(t)}}return e.getAttribute(t)};BXBlockEditorHelper.prototype.paddings=function(e,t,r){if(!e){return}if(typeof r!=="undefined"){if(r=="Y"){BX.addClass(e,"bxBlockPadding")}else{BX.removeClass(e,"bxBlockPadding")}}if(BX.hasClass(e,"bxBlockPadding")){return"Y"}else{return"N"}};BXBlockEditorHelper.prototype.each=function(e,t,r){if(!BX.type.isFunction(t)){return}if(!e||e.length==0){return}for(var i in e){if(typeof e[i]==="undefined"){return}var n=e[i];var o=r||n;t.apply(o,[n,i])}};BXBlockEditorHelper.prototype.imageAutoWidth=function(e,t){var r=BX.findChildren(e,{tag:"img"},true);this.each(r,function(e){e.removeAttribute("width")});var i=this;setTimeout(function(){i.each(r,function(e){e.setAttribute("width",e.offsetWidth)})},1e3)};BXBlockEditorHelper.prototype.imageTextAlign=function(e,t){var r=BX.findChild(e,{className:"bxBlockOut"},true);var i=BX.findChildren(r,{className:"bxBlockContentItemImageText"},true);var n=false;if(BX.findChild(i[0],{className:"bxBlockContentImage"},true)){n=true}t=t||null;if(t){var o=n?i[0]:i[1];var a=n?i[1]:i[0];switch(t){case"left":a.parentNode.insertBefore(o,a);break;case"right":a.parentNode.appendChild(o);break}}if(n)result="left";else result="right";return result};BXBlockEditorHelper.prototype.imageTextPart=function(e,t){var r=BX.findChild(e,{className:"bxBlockInn"},true);var i=BX.findChildren(r,{className:"bxBlockContentItemImageText"},true);var n=false;if(i&&BX.findChild(i[0],{className:"bxBlockContentImage"},true)){n=true}var o=n?i[0]:i[1];var a=n?i[1]:i[0];t=t||null;var l="1/2";var d=580;var f={"1/4":parseInt(d/4),"1/3":parseInt(d/3),"1/2":parseInt(d/2),"2/3":parseInt(2*d/3)};var s=f[l];if(t){s=f[t];a.setAttribute("width",d-s);o.setAttribute("width",s)}var c=l;s=parseInt(o.getAttribute("width"));for(var p in f){if(s==f[p]){c=p;break}}return c};BXBlockEditorHelper.prototype.imageSrc=function(e,t){if(typeof t!=="undefined"){if(!t||t==""){t="/bitrix/images/fileman/block_editor/photo-default.png";this.attr(e,"data-bx-editor-def-image","1")}else{this.attr(e,"data-bx-editor-def-image","0")}this.attr(e,"src",t)}if(this.attr(e,"data-bx-editor-def-image")=="1"){return""}else{return this.attr(e,"src")}};BXBlockEditorHelper.prototype.groupImageSrc=function(e,t){var r=[];var i;var n=function(){var e='<table align="left" border="0" cellpadding="0" cellspacing="0" width="260">'+"<tbody><tr>"+'<td valign="top" class="bxBlockPadding bxBlockContentImage">'+'<img align="left" data-bx-editor-def-image="1" src="/bitrix/images/fileman/block_editor/photo-default.png" class="bxImage"></td>'+"</tr>"+"</tbody></table>";if(!this.imageTempContainer){this.imageTempContainer=BX.create("DIV")}BX.adjust(this.imageTempContainer,{html:e});return BX.findChild(this.imageTempContainer,{})};if(typeof t!=="undefined"){var o=t.split(",");if(!t||t==""){o=[]}var a;i=BX.findChildren(e,{});var l=o.length-i.length;var d=Math.abs(l);var f=l<0;if(l!=0){for(var s=0;s<d;s++){if(f){BX.remove(i.pop())}else{a=n();e.appendChild(a)}}}if(!t||t==""){for(var s=1;s<=2;s++){a=n();e.appendChild(a)}}else{i=BX.findChildren(e,{});for(var s in i){var c=BX.findChild(i[s],{tag:"img"},true);if(!c){continue}this.attr(c,"src",o[s]);this.attr(c,"data-bx-editor-def-image","0")}}}i=BX.findChildren(e,{tag:"img"},true);for(var s in i){if(this.attr(i[s],"data-bx-editor-def-image")=="1"){continue}r.push(this.attr(i[s],"src"))}return r};BXBlockEditorHelper.prototype.textContent=function(e,t){if(!e){return}if(typeof t!=="undefined"){if(t.length>0){e.textContent=t.trim()}else{e.textContent=""}}return e.textContent.trim()};BXBlockEditorHelper.prototype.innerHTML=function(e,t){if(!e){return}if(typeof t!=="undefined"){if(t.length>0){e.innerHTML=t.trim()}else{e.innerHTML=""}}return e.innerHTML.trim()};BXBlockEditorHelper.prototype.htmlEscape=function(e){return String(e).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")};
//# sourceMappingURL=helper.map.js